<!-- 购物车结算页面 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="gbk">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>购物车页面</title>
    <link href="/static/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <link href="/static/css/container.css" rel="stylesheet">
</head>
<body>
    <!-- 头部 -->
    <header onClick="toHome()">
        <div class="navbar navbar-dark bg-dark shadow-sm">
          <div class="container">
            <a href="#" class="navbar-brand d-flex align-items-center">
              <strong>购物车</strong>
            </a>
          </div>
        </div>
      </header>
      <!-- 主体部分 -->
      <main>
        <div class="album py-5 bg-light">
            <div class="container page-container">
                {% if cart_list %}
                    {% for i in cart_list %}
                          <div class="card shadow-sm" style="width:40%;">
                              <img src="{{ i['img'] }}" class="bd-placeholder-img card-img-top" width="100%" height="300">
                              <div class="card-body">
                                <p class="card-text">{{ i['name'] }}</p>
                                <div class="d-flex justify-content-between align-items-center">
                                    <small class="text-muted">￥{{ i['price'] }}</small>
                                </div>
                              </div>
                          </div>
                    {% endfor %}
                {% else %}
                    <a href="/goods">购物车空空如也，快去购物！</a>
                {% endif %}
            </div>
        </div>
        {% if cart_list %}
          <div style="float:right;position:fixed;bottom:20px;right:20px;">
            <button class="btn btn-primary" onClick="shop()">结算</button>
          </div>
        {% endif %}
      </main>
      <script>
        // 结算，直接跳转页面
        function shop() {
          window.location.href = 'shop'
        }
        // 回到首页
        function toHome(){
          window.location.href = '/'
        }
      </script>
</body>
</html>